package com.training.java.core.collections.car.pre15;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * @author Satya
 * 
 */
public class CellPhoneListDemo {

	public static void main(String[] args) {

		// Instantiating Multiple objects

		CellPhone cellPhone1 = new CellPhone("Apple", "iPhone3s", "iOS", 300);
		CellPhone cellPhone2 = new CellPhone("Samsung", "Nexus4", "Android OS",
				350);
		CellPhone cellPhone3 = new CellPhone("Sony", "Xperia", "Android OS",
				200);

		// Creating List

		List listOfPhones = new ArrayList();

		listOfPhones.add(cellPhone1);
		listOfPhones.add(cellPhone2);
		listOfPhones.add(cellPhone3);
		listOfPhones.add(cellPhone3);

		// listOfPhones.add(null);

		// Cteating iterator
		Iterator ite = listOfPhones.iterator();

		while (ite.hasNext()) {
			CellPhone cellPhone = (CellPhone) ite.next();

			System.out.println(" Cell  Company : " + cellPhone.getCompany());
			System.out.println(" Cell  Model : " + cellPhone.getModel());
			System.out.println(" Cell operatingSystem : "
					+ cellPhone.getOperatingSystem());
			System.out.println(" Cell  Price  : " + cellPhone.getPrice());
			System.out.println("*******************************");
		}

	}

}
